#ifndef DEF_LIBROBOT
#define DEF_LIBROBOT

#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/interrupt.h> 
#define LED_R PB0
#define LED_V PB1
#define BUTTON_PIN PIND
#define BUTTON PD2
#define set_input(portdir,pin) portdir &= ~(1<<pin)
#define set_output(portdir,pin) portdir |= (1<<pin)
#define output_high(port,pin) port |= (1<<pin)
#define output_low(port,pin) port &= ~(1<<pin)



class librobot{
public :
	int button_pressed(uint8_t ms); //TP2-PB2
	void affiche_ambre(/*ambre durant 4ms*/);
	void pwm(int freq, int ratio, int delay, uint8_t pin); //TP4-PB1
	void partirMinuterie ( uint16_t duree ); //TP5-PB2
	void initialisation (); //TP7-PB2
	void myDelay(int length); //TP6-PB1
	void initialisationUART ( void ); //TP6-PB2
	char receptionUART(); //TP6-PB2
	void transmissionUART( char donnee ) //TP6-PB2

private :
	volatile uint8_t etat;
	volatile uint8_t minuterieExpiree;
}

#endif